#ifndef LOGFILEDIALOG_H
#define LOGFILEDIALOG_H

#include <QtGui/QDialog>
#include <QString>
#include "linevalidator.h"
#include <QFile>
#include <QStringList>
#include "invalidhighlighter.h"

namespace Ui {
    class LogfileDialog;
}

class LogfileDialog : public QDialog {
    Q_OBJECT
    Q_DISABLE_COPY(LogfileDialog)
public:
    explicit LogfileDialog(QWidget *parent = 0,LineValidator* linevalidator = NULL, QString fileName=QString());
    virtual ~LogfileDialog();


protected:
    virtual void changeEvent(QEvent *e);

private:
    Ui::LogfileDialog *m_ui;
    LineValidator* m_lineValidator;
    QFile* m_file; // the file we are working with
    qint64 m_totalsize; // size of the file
    QStringList m_sampleLines;

    InvalidHighlighter* m_invalidHighlighter;

protected slots:
    void start(QString fileName); // this is called after the constructor is  done
    void setLineValidation(QString lineValidationString);
    void setLineValidation(LineValidator* linevalidator);
    void showSample(); // this is called when you want to show the sample lines and the transformed lines
    void showTransformedSample(); // this  calculates and shows the transformed sample.

    void updateLineSyntax(QString);
    void updateInvalidLineSyntax(QString);
    void updateDurationSyntax(QString);
    void updateStatementSyntax(QString);

signals:
    void SIGshowSample();
    void SIGshowTransformedSample();
public slots:
    void showLineValidatorData();
};

#endif // LOGFILEDIALOG_H
